<script>
// 使用render函数的好处是可以动态创建标签f
export default {
  props: {
    tag: String
  },
  data() {
    return {
      people: ["小李", "小王", "小张"]
    };
  },
  render(createElement) {
    // createElement参数（标签(组件)，属性，子节点）
    return createElement(
      this.tag,
      {},
      this.people.map(name =>
        createElement(
          "li",
          {
            attrs: { class: "test" },
            on: {
              click: () => {
                console.log(name);
              }
            }
          },
          `${name}`
        )
      )
    );
  }
};
</script>
<style lang="scss" scoped>
.wrapper {
}
</style>
